<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:comp="clr-namespace:FiveInARow.Components"
	xmlns:gl="clr-namespace:GameLogic;assembly=GameLogic"
    xmlns:local="clr-namespace:FiveInARow">


	<Style TargetType="{x:Type comp:Cell}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type comp:Cell}">
					<Grid Width="{x:Static local:Constants.CellWidth}" Height="{x:Static local:Constants.CellWidth}">
						<Border Name="el" BorderBrush="Gray" BorderThickness="0" Margin="1" />
                        <Rectangle Stroke="LightGray" StrokeThickness="1" StrokeDashArray="2 2" Fill="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                        <TextBlock Name="txt" HorizontalAlignment="Center" FontSize="9" VerticalAlignment="Center" Visibility="Collapsed" Text="{Binding Probability}" />
                        <Viewbox StretchDirection="DownOnly" Margin="5" x:Name="pX" Visibility="Collapsed">
                            <Grid>
                                <Line Stroke="Red" StrokeThickness="3" X1="0" Y1="0" X2="{x:Static local:Constants.CellWidth}" Y2="{x:Static local:Constants.CellWidth}" />
                                <Line Stroke="Red" StrokeThickness="3" X1="{x:Static local:Constants.CellWidth}" Y1="0" X2="0" Y2="{x:Static local:Constants.CellWidth}" />
                            </Grid>
                        </Viewbox>
                        <Viewbox StretchDirection="DownOnly" Margin="5" x:Name="pO" Visibility="Collapsed">
                            <Ellipse Stroke="Blue" StrokeThickness="3" Width="{x:Static local:Constants.CellWidth}" Height="{x:Static local:Constants.CellWidth}" />
                        </Viewbox>
                    </Grid>
					<ControlTemplate.Triggers>
						<MultiDataTrigger>
							<MultiDataTrigger.Conditions>
								<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"/>
								<Condition Binding="{Binding Path=Value}" Value="{x:Static gl:CellValue.Unset}"/>
							</MultiDataTrigger.Conditions>
							<Setter TargetName="el" Property="Opacity" Value="0.7" />
						</MultiDataTrigger>
						<Trigger Property="Value" Value="{x:Static gl:CellValue.X}">
                            <Setter TargetName="pX" Property="Visibility" Value="Visible" />
                            <Setter TargetName="el" Property="Visibility" Value="Collapsed" />
						</Trigger>
						<Trigger Property="Value" Value="{x:Static gl:CellValue.O}">
                            <Setter TargetName="pO" Property="Visibility" Value="Visible" />
                            <Setter TargetName="el" Property="Visibility" Value="Collapsed" />
						</Trigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Value}" Value="{x:Static gl:CellValue.AI_UnderConsideration}" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext.ShowProbabilities}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="txt" Property="Visibility" Value="Visible" />
                        </MultiDataTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
